/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package uit_vendor_management;

import java.awt.Dialog;
import java.awt.Window;

/**
 *
 * @author QuangKhoi
 */
public class VendorRegisForm extends javax.swing.JDialog {
    Vendor vdr;
    /**
     * Creates new form VendorRegisForm
     */
    public VendorRegisForm(Window owner, Dialog.ModalityType modal) {
        super(owner, modal);
        initComponents();
        this.setLocationRelativeTo(owner);
        this.LoadQuan();
        this.LoadLoaiDaiLy();
        this.LoadDaiLy();
    }
    
    public final void LoadQuan() {
        cbxQuan.setModel(District.getModel());
    }
    
    public final void LoadLoaiDaiLy() {
        cbxLoaiDaiLy.setModel(VendorType.getModel());
    }
    
    public final void LoadDaiLy() {
        tblData.setModel(Vendor.getModel());
    }
    
    public void LoadVendor(String MaDaiLy) {
        vdr = new Vendor(MaDaiLy);
        tbxMaDaiLy.setText(vdr.MaDaiLy);
        tbxDiaChi.setText(vdr.DiaChi);
        tbxDienThoai.setText(vdr.DienThoai);
        tbxEmail.setText(vdr.Email);
        tbxTen.setText(vdr.TenDaiLy);
        cbxLoaiDaiLy.setSelectedItem(vdr.LoaiDL.TenLoaiDaiLy);
        cbxQuan.setSelectedItem(vdr.quan.TenQuan);
    }
    
    public void LoadVendor() {
        vdr = new Vendor();
        tbxMaDaiLy.setText(vdr.MaDaiLy);
        tbxDiaChi.setText(vdr.DiaChi);
        tbxDienThoai.setText(vdr.DienThoai);
        tbxEmail.setText(vdr.Email);
        tbxTen.setText(vdr.TenDaiLy);
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        lblTitle = new javax.swing.JLabel();
        pnlMain = new javax.swing.JPanel();
        tbxMaDaiLy = new javax.swing.JTextField();
        lblUsername = new javax.swing.JLabel();
        tbxTen = new javax.swing.JTextField();
        tbxDienThoai = new javax.swing.JTextField();
        tbxEmail = new javax.swing.JTextField();
        lblTen = new javax.swing.JLabel();
        lblDienThoai = new javax.swing.JLabel();
        lblQuan = new javax.swing.JLabel();
        lblEmail = new javax.swing.JLabel();
        tbxDiaChi = new javax.swing.JTextField();
        cbxNgayTiepNhan = new javax.swing.JTextField();
        lblNgayTiepNhan = new javax.swing.JLabel();
        lblDiaChi = new javax.swing.JLabel();
        lblLoaiDaiLy = new javax.swing.JLabel();
        cbxLoaiDaiLy = new javax.swing.JComboBox();
        cbxQuan = new javax.swing.JComboBox();
        btnRegis = new javax.swing.JButton();
        btnClear = new javax.swing.JButton();
        btnUpdate = new javax.swing.JButton();
        btnNewRegis = new javax.swing.JButton();
        btnExit = new javax.swing.JButton();
        jScrollPane2 = new javax.swing.JScrollPane();
        tblData = new javax.swing.JTable();

        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowOpened(java.awt.event.WindowEvent evt) {
                formWindowOpened(evt);
            }
        });

        lblTitle.setFont(new java.awt.Font("Calibri", 0, 36)); // NOI18N
        lblTitle.setText("Tiếp nhận Đại lý");

        pnlMain.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));

        tbxMaDaiLy.setFont(new java.awt.Font("Calibri", 0, 14)); // NOI18N
        tbxMaDaiLy.setAlignmentX(5.0F);
        tbxMaDaiLy.setAlignmentY(5.0F);
        tbxMaDaiLy.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(204, 204, 204)));
        tbxMaDaiLy.setMinimumSize(new java.awt.Dimension(2, 24));
        tbxMaDaiLy.setPreferredSize(new java.awt.Dimension(2, 24));

        lblUsername.setFont(new java.awt.Font("Calibri", 0, 14)); // NOI18N
        lblUsername.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        lblUsername.setText("Mã Đại Lý");

        tbxTen.setFont(new java.awt.Font("Calibri", 0, 14)); // NOI18N
        tbxTen.setAlignmentX(5.0F);
        tbxTen.setAlignmentY(5.0F);
        tbxTen.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(204, 204, 204)));
        tbxTen.setMinimumSize(new java.awt.Dimension(2, 24));
        tbxTen.setPreferredSize(new java.awt.Dimension(2, 24));

        tbxDienThoai.setFont(new java.awt.Font("Calibri", 0, 14)); // NOI18N
        tbxDienThoai.setAlignmentX(5.0F);
        tbxDienThoai.setAlignmentY(5.0F);
        tbxDienThoai.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(204, 204, 204)));
        tbxDienThoai.setMinimumSize(new java.awt.Dimension(2, 24));
        tbxDienThoai.setPreferredSize(new java.awt.Dimension(2, 24));

        tbxEmail.setFont(new java.awt.Font("Calibri", 0, 14)); // NOI18N
        tbxEmail.setAlignmentX(5.0F);
        tbxEmail.setAlignmentY(5.0F);
        tbxEmail.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(204, 204, 204)));
        tbxEmail.setMinimumSize(new java.awt.Dimension(2, 24));
        tbxEmail.setPreferredSize(new java.awt.Dimension(2, 24));
        tbxEmail.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                tbxEmailActionPerformed(evt);
            }
        });

        lblTen.setFont(new java.awt.Font("Calibri", 0, 14)); // NOI18N
        lblTen.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        lblTen.setText("Tên");

        lblDienThoai.setFont(new java.awt.Font("Calibri", 0, 14)); // NOI18N
        lblDienThoai.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        lblDienThoai.setText("Điện Thoại");

        lblQuan.setFont(new java.awt.Font("Calibri", 0, 14)); // NOI18N
        lblQuan.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        lblQuan.setText("Quận");

        lblEmail.setFont(new java.awt.Font("Calibri", 0, 14)); // NOI18N
        lblEmail.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        lblEmail.setText("Email");

        tbxDiaChi.setFont(new java.awt.Font("Calibri", 0, 14)); // NOI18N
        tbxDiaChi.setAlignmentX(5.0F);
        tbxDiaChi.setAlignmentY(5.0F);
        tbxDiaChi.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(204, 204, 204)));
        tbxDiaChi.setMinimumSize(new java.awt.Dimension(2, 24));
        tbxDiaChi.setPreferredSize(new java.awt.Dimension(2, 24));

        cbxNgayTiepNhan.setFont(new java.awt.Font("Calibri", 0, 14)); // NOI18N
        cbxNgayTiepNhan.setAlignmentX(5.0F);
        cbxNgayTiepNhan.setAlignmentY(5.0F);
        cbxNgayTiepNhan.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(204, 204, 204)));
        cbxNgayTiepNhan.setMargin(new java.awt.Insets(2, 2, 2, 0));
        cbxNgayTiepNhan.setMinimumSize(new java.awt.Dimension(2, 24));
        cbxNgayTiepNhan.setPreferredSize(new java.awt.Dimension(2, 24));

        lblNgayTiepNhan.setFont(new java.awt.Font("Calibri", 0, 14)); // NOI18N
        lblNgayTiepNhan.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        lblNgayTiepNhan.setText("Ngày Tiếp Nhận");

        lblDiaChi.setFont(new java.awt.Font("Calibri", 0, 14)); // NOI18N
        lblDiaChi.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        lblDiaChi.setText("Địa Chỉ");

        lblLoaiDaiLy.setFont(new java.awt.Font("Calibri", 0, 14)); // NOI18N
        lblLoaiDaiLy.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        lblLoaiDaiLy.setText("Loại Đại Lý");

        cbxLoaiDaiLy.setEditable(true);
        cbxLoaiDaiLy.setFont(new java.awt.Font("Calibri", 0, 14)); // NOI18N
        cbxLoaiDaiLy.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
        cbxLoaiDaiLy.setMinimumSize(new java.awt.Dimension(51, 22));
        cbxLoaiDaiLy.setPreferredSize(new java.awt.Dimension(56, 22));

        cbxQuan.setEditable(true);
        cbxQuan.setFont(new java.awt.Font("Calibri", 0, 14)); // NOI18N
        cbxQuan.setMinimumSize(new java.awt.Dimension(51, 22));
        cbxQuan.setPreferredSize(new java.awt.Dimension(56, 22));

        javax.swing.GroupLayout pnlMainLayout = new javax.swing.GroupLayout(pnlMain);
        pnlMain.setLayout(pnlMainLayout);
        pnlMainLayout.setHorizontalGroup(
            pnlMainLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlMainLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pnlMainLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lblUsername, javax.swing.GroupLayout.PREFERRED_SIZE, 91, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblTen, javax.swing.GroupLayout.PREFERRED_SIZE, 91, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblDienThoai, javax.swing.GroupLayout.PREFERRED_SIZE, 91, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblQuan, javax.swing.GroupLayout.PREFERRED_SIZE, 91, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblEmail, javax.swing.GroupLayout.PREFERRED_SIZE, 91, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pnlMainLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(tbxMaDaiLy, javax.swing.GroupLayout.DEFAULT_SIZE, 203, Short.MAX_VALUE)
                    .addComponent(tbxTen, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(tbxDienThoai, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(tbxEmail, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(cbxQuan, 0, 203, Short.MAX_VALUE))
                .addGap(18, 18, 18)
                .addGroup(pnlMainLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lblLoaiDaiLy, javax.swing.GroupLayout.PREFERRED_SIZE, 91, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblDiaChi, javax.swing.GroupLayout.PREFERRED_SIZE, 91, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblNgayTiepNhan, javax.swing.GroupLayout.PREFERRED_SIZE, 91, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pnlMainLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(cbxLoaiDaiLy, 0, 165, Short.MAX_VALUE)
                    .addComponent(tbxDiaChi, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(cbxNgayTiepNhan, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );
        pnlMainLayout.setVerticalGroup(
            pnlMainLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlMainLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pnlMainLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(pnlMainLayout.createSequentialGroup()
                        .addGroup(pnlMainLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(tbxMaDaiLy, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lblUsername))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(pnlMainLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(tbxTen, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lblTen))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(pnlMainLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(tbxDienThoai, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lblDienThoai))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(pnlMainLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(lblQuan)
                            .addComponent(cbxQuan, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(pnlMainLayout.createSequentialGroup()
                        .addGroup(pnlMainLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(cbxLoaiDaiLy, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lblLoaiDaiLy))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(pnlMainLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(tbxDiaChi, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lblDiaChi))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(pnlMainLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(cbxNgayTiepNhan, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lblNgayTiepNhan))))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pnlMainLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(tbxEmail, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblEmail))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        btnRegis.setBackground(new java.awt.Color(230, 230, 230));
        btnRegis.setFont(new java.awt.Font("Calibri", 0, 14)); // NOI18N
        btnRegis.setText("Tiếp nhận");
        btnRegis.setBorder(null);
        btnRegis.setMaximumSize(new java.awt.Dimension(41, 20));
        btnRegis.setMinimumSize(new java.awt.Dimension(41, 20));
        btnRegis.setPreferredSize(new java.awt.Dimension(41, 20));
        btnRegis.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnRegisActionPerformed(evt);
            }
        });

        btnClear.setBackground(new java.awt.Color(230, 230, 230));
        btnClear.setFont(new java.awt.Font("Calibri", 0, 14)); // NOI18N
        btnClear.setText("Xóa");
        btnClear.setBorder(null);
        btnClear.setMaximumSize(new java.awt.Dimension(41, 20));
        btnClear.setMinimumSize(new java.awt.Dimension(41, 20));
        btnClear.setPreferredSize(new java.awt.Dimension(41, 20));
        btnClear.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnClearActionPerformed(evt);
            }
        });

        btnUpdate.setBackground(new java.awt.Color(230, 230, 230));
        btnUpdate.setFont(new java.awt.Font("Calibri", 0, 14)); // NOI18N
        btnUpdate.setText("Cập nhật");
        btnUpdate.setBorder(null);
        btnUpdate.setMaximumSize(new java.awt.Dimension(41, 20));
        btnUpdate.setMinimumSize(new java.awt.Dimension(41, 20));
        btnUpdate.setPreferredSize(new java.awt.Dimension(41, 20));
        btnUpdate.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnUpdateActionPerformed(evt);
            }
        });

        btnNewRegis.setBackground(new java.awt.Color(230, 230, 230));
        btnNewRegis.setFont(new java.awt.Font("Calibri", 0, 14)); // NOI18N
        btnNewRegis.setText("Tiếp nhận mới");
        btnNewRegis.setBorder(null);
        btnNewRegis.setMaximumSize(new java.awt.Dimension(41, 20));
        btnNewRegis.setMinimumSize(new java.awt.Dimension(41, 20));
        btnNewRegis.setPreferredSize(new java.awt.Dimension(41, 20));
        btnNewRegis.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnNewRegisActionPerformed(evt);
            }
        });

        btnExit.setBackground(new java.awt.Color(230, 230, 230));
        btnExit.setFont(new java.awt.Font("Calibri", 0, 14)); // NOI18N
        btnExit.setText("Thoát");
        btnExit.setBorder(null);
        btnExit.setMaximumSize(new java.awt.Dimension(41, 20));
        btnExit.setMinimumSize(new java.awt.Dimension(41, 20));
        btnExit.setPreferredSize(new java.awt.Dimension(41, 20));
        btnExit.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnExitActionPerformed(evt);
            }
        });

        tblData.setFont(new java.awt.Font("Calibri", 0, 14)); // NOI18N
        tblData.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Mã Đại Lý", "Tên Đại Lý", "Loại Đại Lý", "Ngày Tiếp Nhận"
            }
        ) {
            boolean[] canEdit = new boolean [] {
                false, false, false, false
            };

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        tblData.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        jScrollPane2.setViewportView(tblData);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(pnlMain, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(54, 54, 54)
                        .addComponent(lblTitle)
                        .addGap(0, 0, Short.MAX_VALUE))
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(btnRegis, javax.swing.GroupLayout.PREFERRED_SIZE, 96, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnClear, javax.swing.GroupLayout.PREFERRED_SIZE, 96, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnUpdate, javax.swing.GroupLayout.PREFERRED_SIZE, 96, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnNewRegis, javax.swing.GroupLayout.PREFERRED_SIZE, 96, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 100, Short.MAX_VALUE)
                        .addComponent(btnExit, javax.swing.GroupLayout.PREFERRED_SIZE, 96, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jScrollPane2)))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addGap(28, 28, 28)
                .addComponent(lblTitle)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(pnlMain, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 91, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnRegis, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btnClear, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btnUpdate, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btnNewRegis, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btnExit, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );

        pack();
        setLocationRelativeTo(null);
    }// </editor-fold>//GEN-END:initComponents

    private void btnRegisActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnRegisActionPerformed
        // TODO add your handling code here:
        vdr.TenDaiLy = tbxTen.getText();
        vdr.DienThoai = tbxDienThoai.getText();
    }//GEN-LAST:event_btnRegisActionPerformed

    private void btnClearActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnClearActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_btnClearActionPerformed

    private void btnUpdateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnUpdateActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_btnUpdateActionPerformed

    private void btnNewRegisActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnNewRegisActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_btnNewRegisActionPerformed

    private void btnExitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnExitActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_btnExitActionPerformed

    private void tbxEmailActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tbxEmailActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_tbxEmailActionPerformed

    private void formWindowOpened(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowOpened
        // TODO add your handling code here:
        vdr = new Vendor();
        LoadVendor();
    }//GEN-LAST:event_formWindowOpened

    /**
     * @param args the command line arguments
     */
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnClear;
    private javax.swing.JButton btnExit;
    private javax.swing.JButton btnNewRegis;
    private javax.swing.JButton btnRegis;
    private javax.swing.JButton btnUpdate;
    private javax.swing.JComboBox cbxLoaiDaiLy;
    private javax.swing.JTextField cbxNgayTiepNhan;
    private javax.swing.JComboBox cbxQuan;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JLabel lblDiaChi;
    private javax.swing.JLabel lblDienThoai;
    private javax.swing.JLabel lblEmail;
    private javax.swing.JLabel lblLoaiDaiLy;
    private javax.swing.JLabel lblNgayTiepNhan;
    private javax.swing.JLabel lblQuan;
    private javax.swing.JLabel lblTen;
    private javax.swing.JLabel lblTitle;
    private javax.swing.JLabel lblUsername;
    private javax.swing.JPanel pnlMain;
    private javax.swing.JTable tblData;
    private javax.swing.JTextField tbxDiaChi;
    private javax.swing.JTextField tbxDienThoai;
    private javax.swing.JTextField tbxEmail;
    private javax.swing.JTextField tbxMaDaiLy;
    private javax.swing.JTextField tbxTen;
    // End of variables declaration//GEN-END:variables
}
